home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 27 / CU Amiga Magazine's Super CD-ROM 27 (1998)(EMAP Images)(GB)[!][issue 1998-10].iso / CUCD / Programming / JForth / JTools / Demos / demo_dots < prev    next >
Encoding:
Text File  |  1991-08-14  |  984 b   |  32 lines

  1. \ Sample JForth Program for Amiga, from Delta Research.
  2. \ Similar to "DOTS" program from Commodore.
  3. \
  4. \ Compile some toolboxes if not already compiled.
  5. include? gr.init     ju:amiga_graph
  6. include? ?closebox   ju:amiga_events
  7. include? choose      ju:random
  8.  
  9. : RANDOM.DOTS ( -- , Draw randomly colored dots. )
  10.     BEGIN
  11. \ Pick random color and use it.
  12.         4 choose   gr.color!
  13. \ Use pointer to current RastPort.
  14.         gr-currport @
  15. \ Get size of Window by accessing window structure.
  16. \ Then choose random numbers within that range.
  17. \ In 'C' this would be   x = choose(gr_curwindow->width);
  18.         gr-curwindow @  ..@ wd_width   choose
  19.         gr-curwindow @  ..@ wd_height  choose
  20. \ Call Amiga Library routine, Stack has -- rp x y
  21.         call graphics_lib WritePixel drop  ( Easy huh? )
  22. \ Has close box been hit?
  23.         ?closebox
  24.     UNTIL
  25. ;
  26.  
  27. : DOTS   ( -- , Perform DOTS demo )
  28.     gr.init   gr.opentest   \ Open a simple window.
  29.     random.dots             \ Do graphics.
  30.     gr.closecurw  gr.term   \ Close current window.
  31. ;
  32.